<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/templates/padrao.xhtml">
	<ui:define name="content">
		<h:form id="formPerfilHome" style="whidt:100%;">
			<p:messages id="messages" autoUpdate="true" closable="true" />
			<p:panel header="Cadastro de Perfil" style="whidt:100%;">
				<h:panelGrid columns="3" id="painel" width="100%">

					<h:outputText value="Perfil" />
					<p:inputText id="perfilNome" size="60"
						value="#{perfilHome.perfil.nome}" title="informe o nome do perfil"
						required="true" requiredMessage="o perfil deve ser informado"
						label="o perfil deve ser informado" maxlength="100"
						style="width:400px;" />
					<p:tooltip for="perfilNome" showEvent="focus" hideEvent="blur" />

				</h:panelGrid>

			</p:panel>

			<p:commandButton value="Salvar" action="#{perfilHome.save}"
				update="painelLista,painel" />
			<p:commandButton value="Novo" icon="ui-icon-document"
				action="#{perfilHome.clean()}" update="painel" immediate="true" />


			<p:dataTable var="listPerfils" id="painelLista"
				value="#{perfilHome.perfils}" paginator="true" rows="5"
				style="max-width: 100%; min-width: 100%"
				emptyMessage="Nenhum registro.">

				<p:column style="max-width: 10%; min-width: 10%; ">
					<f:facet name="header" width="10%">
						<h:outputText value="Codigo" />
					</f:facet>
					<h:outputText value="#{listPerfils.id}" />
				</p:column>

				<p:column style="max-width: 70%; min-width: 70%; overflow: hidden">
					<f:facet name="header">
						<h:outputText value="Nome" width="70%" />
					</f:facet>
					<h:outputText value="#{listPerfils.nome}" />
				</p:column>

				<p:column width="15%">
					<p:commandButton title="Editar" update="painel" immediate="true"
						action="#{perfilHome.edit}" ajax="false"
						icon="ui-icon-folder-open">
						<f:setPropertyActionListener target="#{perfilHome.selected}"
							value="#{listPerfils}" />
					</p:commandButton>
				</p:column>

				<p:column width="15%">
					<p:commandButton title="Excluir" update="painel" immediate="true"
						action="#{perfilHome.remove}" ajax="false" icon="ui-icon-trash">
						<f:setPropertyActionListener target="#{perfilHome.selected}"
							value="#{listPerfils}" />
					</p:commandButton>
				</p:column>

			</p:dataTable>

		</h:form>

	</ui:define>
</ui:composition>